package com.thirteen.app.service.impl;

import com.thirteen.app.daoTest.AnswerDao;
import com.thirteen.app.entity.Answer;
import com.thirteen.app.service.AnswerService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("answerService")
public class AnswerServiceImpl implements AnswerService {

    @Resource
    private AnswerDao answerDao;

    @Override
    public List<Answer> insert(List<Answer> answers) {
        return answerDao.insert(answers);
    }

    @Override
    public Answer update(Integer solutionId, Boolean isRight, String content, String tag) {
        Answer answer = new Answer();
        answer.setSolutionId(solutionId);
        answer.setIsRight(isRight);
        answer.setContent(content);
        answer.setTag(tag);
        answerDao.update(answer);
        return answer;
    }

    @Override
    public int delete(Integer solutionId) {
        return answerDao.delete(solutionId);
    }
}
